package server

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

// HandleHTTPUpGrade 处理 http 升级为 websocket
func (s *server) HandleHTTPUpGrade(c *gin.Context) {
	err := s.Socket.HandleRequest(c.Writer, c.Request)
	if err != nil {
		log.Errorf("升级为 websocket 协议时发送了错误 %s", err)
		c.JSON(500, &output{500, fmt.Sprintf("升级为 websocket 协议时发送了错误 %s", err), nil})
	}
}
